package demo6;

public class Person {
    public String id;//学号  身份证号

    public Person(String id) {
        this.id = id;
    }


    /*@Override
    public boolean equals(Object obj){
        if (obj == null) {
            return false;
        }
        //person1.equals(person1)
        if (this == obj) {
            return true;
        }
        //不是同一个类型
        person1.equals(dog)
        if (!(obj instanceof Person)) {
            return false;
        }

        Person tmp = (Person)obj;
        */
        /*if (tmp.id.equals(this.id))

    {
        return ture;

    }*/
    /*@Override
    public int hashCode(){
        return Object.hash(id);
    }*/

    @Override
    public boolean equals(Object o){
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Object.equals(id,person.id);
    }
    @Override
    public int hashCode(){
        return Object.hash(id);
    }

    @Override
    public String toString() {
        return "Person{" +
                "id='" + id + '\'' +
                '}';
    }
}
